import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

interface ComponentsData {
  props: { [key: string]: any }
  id: string
  name: string
}
export interface EditorProps {
  components: ComponentsData[]
  currentElement: string
}

export const testComponents: ComponentsData[] = [
  {
    id: '0000',
    name: 'l-text',
    props: { text: 'hello' }
  },
  {
    id: '0002',
    name: 'l-text',
    props: { text: 'hello2' }
  },
  {
    id: '0003',
    name: 'l-text',
    props: { text: 'hello3' }
  }
]

export const useEditorStore = defineStore('editor', () => {
  const editor = ref({
    components: testComponents,
    currentElement: ''
  })
  // const doubleCount = computed(() => count.value * 2)
  // function increment() {
  //   count.value++
  // }

  return { editor }
})
